﻿using System;
using System.Diagnostics;
using System.Xml.Serialization;
using PrearrangedChaos.AgileZen.Service.Rest;

namespace PrearrangedChaos.AgileZen.Service.Model
{
    /// <remarks/>
    [XmlType(AnonymousType = true)]
    [XmlRootAttribute(ElementName = "attachment", Namespace = "", IsNullable = false)]
    [ZenRestRequest("projects/{0}/stories/{1}/attachments/{2}", "projects/{0}/stories/{1}/attachments")]
    public partial class Attachment : AttachmentUpdater, IAttachment
    {
        private string _contentType;

        /// <remarks/>
        [XmlElement(ElementName = "contentType")]
        public string ContentType
        {
            get { return _contentType; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                    _contentType = value;
                else
                    _contentType = null;
            }
        }

        public bool ContentTypeSpecified { get { return false; } }

        /// <remarks/>
        [XmlElement(ElementName = "sizeInBytes")]
        public int SizeInBytes { get; set; }

        public bool SizeInBytesSpecified { get { return false; } }

        private string _token;

        /// <remarks/>
        [XmlElement(ElementName = "token")]
        public string Token
        {
            get { return _token; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                    _token = value;
                else
                    _token = null;
            }
        }

        public bool TokenSpecified { get { return false; } }
    }
}